#include <iostream>

using namespace std;

int main(void)
{
    int arr[9] = {4, 2, 8, 0, 5, 7, 1, 3, 9};

    int i, j;
    int exchange;
    for (i = 8; i > 0; i--)
    {
        for (j = 0; j < i; j++)
        {
            if(arr[j] > arr[j + 1])
            {
                exchange = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = exchange;
            }
        }
    }

    for (i = 0; i < 9; i++)
    {
        cout << arr[i] << endl;
    }

    return 0;
}